package edu.jd.movieplatform.user.order;

import edu.jd.movieplatform.common.Result;
import edu.jd.movieplatform.user.ticket.TicketDto;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user/order")
public class OrderAPI {
    @Resource
    private UserOrderService orderService;

    @PostMapping("/submit_order")
    public Result generateOrder(@RequestBody OrderDto[] dtoList){
        List<TicketDto> ticketDtoList = orderService.submitOrder(dtoList);
        return Result.success("提交订单成功！", ticketDtoList);
    }
}
